package com.xinyue.game.client;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import com.alibaba.fastjson.JSONObject;
import com.xinyue.game.client.service.GameRemoteClient;

/**
 * 
 * @ClassName: GameClientMain
 * @Description: 这个client是用来模拟客户端进行连接测试用的
 * @author: wgs
 * @date: 2018年12月1日 下午11:49:01
 */
@SpringBootApplication
public class GameClientMain {
    private static GameRemoteClient remoteClient;

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(GameClientMain.class);
        app.setWebApplicationType(WebApplicationType.NONE);
        app.run(args);
        remoteClient = new GameRemoteClient();
        remoteClient.connect();
        confirmLogin();
        
        try {
            Thread.sleep(400000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
       // remoteClient.close();
       // System.exit(0);
    }

    public static void confirmLogin() {
        JSONObject data = new JSONObject();
        data.put("userId", 101);
        data.put("roleId", 201);
        remoteClient.sendMessage(data, 1);
    }


}
